﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

/**
 * 创建时间：2014/9/19 10:36:20
 * 作者：yong.blackcore
 * Email：itblackhole@outlook.com
 * QQ：50404503
 */
namespace SurfaceAd.Assistant
{


    internal sealed class Constants
    {
        /// <summary>
        /// 通过WebView获取设备信息
        /// </summary>
        public static IDictionary<string, string> NavigatorKeys = new Dictionary<string, string>();
        static Constants()
        {
            NavigatorKeys.Add(WebViewNavigatorKey.appCodeName.ToString(), "navigator.appVersion");
            NavigatorKeys.Add(WebViewNavigatorKey.appName.ToString(), "navigator.appName");
            NavigatorKeys.Add(WebViewNavigatorKey.appVersion.ToString(), "navigator.appVersion");
            NavigatorKeys.Add(WebViewNavigatorKey.platform.ToString(), "navigator.platform");
            NavigatorKeys.Add(WebViewNavigatorKey.language.ToString(), "navigator.language");
            NavigatorKeys.Add(WebViewNavigatorKey.systemLanguage.ToString(), "navigator.systemLanguage");
            //NavigatorKeys.Add(WebViewNavigatorKey.userAgent.ToString(), "navigator.userAgent");
            //NavigatorKeys.Add(WebViewNavigatorKey.onLine.ToString(), "navigator.onLine");
            //NavigatorKeys.Add(WebViewNavigatorKey.cookieEnabled.ToString(), "navigator.cookieEnabled");
        }


        /// <summary>
        /// yyyyMMddHHmmss.fff
        /// </summary>
        public const string DATETIME_FORMAT = "yyyyMMddHHmmss.fff";

        /// <summary>
        /// 默认是Debug模式，不参与计费
        /// </summary>
        public static AdRequestModel AdModel = AdRequestModel.Debug;

        /// <summary>
        /// Portable的配置文件
        /// <para>AppxManifest.xml</para>
        /// </summary>
        public const String AppManifest = "AppxManifest.xml";

        /// <summary>
        /// 版本
        /// <para>Windows运行时组件(Windows Phone 8.1)之程序集版本V1.0.0.0的SurfaceAd的SDK</para>
        /// </summary>
        public const String AdSDKVersion = "SurfaceAd_WPWRTCV8.1_AC1.0.0.0";


        public const String AdRequestAddress = "http://s.surfacead.com/l.php";

        public const Int32 AdRefreshIntervalDefault = 15;

        public const Int32 AdRefreshIntervalMin = 5;

        /// <summary>
        /// 请求参数
        /// <para>?a=</para>
        /// </summary>
        public static string Ad_REQUESTQUERYKEY = "?a=";

        /// <summary>
        /// 缓存目录
        /// </summary>
        public const string AdCacheDirectory = "surfacead_wpwrt_cache";

        /// <summary>
        /// 启动器：根据appId打开应用商店下载地址
        /// <para>相当于WPforSL中的MarketplaceDetailTask</para>
        /// <para>加前缀zune:navigate?appid=即可实现</para>
        /// <para>Windows.System.Launcher.LaunchUriAsync(new Uri("zune:navigate?appid=16d44786-b00a-43df-97eb-41e29c957a56"));</para>
        /// </summary>
        public const string LaunchMarketplaceDetailTask = "zune:navigate?appid=";

        /// <summary>
        /// 启动器：拔打电话
        /// <para>相当于WPforSL中的PhoneCallTask</para>
        /// <para>Windows.System.Launcher.LaunchUriAsync(new Uri("tel:15001352188"));</para>
        /// </summary>
        public const string LaunchPhoneCallTask = "tel:";
    }

    /// <summary>
    /// SDK广告请求模式
    /// <para>调试或发布</para>
    /// </summary>
    public enum AdRequestModel
    {
        /// <summary>
        /// 正常模式
        /// </summary>
        Normal = 0,
        /// <summary>
        /// 调试模式
        /// <para>不参与计费</para>
        /// </summary>
        Debug = 1
    }


    /// <summary>
    /// 插屏广告类型
    /// </summary>
    public enum AdInterstitialScreenType
    {      
        /// <summary>
        /// 必须设置为Screen或Interstitial类型
        /// </summary>
        None,
        /// <summary>
        /// 应用首次启动加载的开屏广告
        /// <para>开屏广告成功加载后，默认展示3秒后关闭</para>
        /// <para>不支持点击后跳转</para>
        /// <para></para>
        /// </summary>
        Screen,

        /// <summary>
        /// 应用使用中的插屏广告
        /// <para>轮播方式</para>
        /// <para>支持点击后跳转</para>
        /// </summary>
        Interstitial
    }

    /// <summary>
    /// 与服务器通讯时网络标识
    /// </summary>
    internal enum DeviceNetworkType
    {
        None = 0,
        Wifi = 1,
        Mobile2G = 2,
        Mobile3G = 3,
        Mobile4G = 4,
        /// <summary>
        /// 有线网络
        /// </summary>
        HasLineInternal = 9
    }

    /// <summary>
    /// navigator的相关属性
    /// </summary>
    public enum WebViewNavigatorKey
    {
        appCodeName,
        appName,
        appVersion,
        platform,
        language,
        systemLanguage,
        [Obsolete]
        userAgent,
        [Obsolete]
        onLine,
        [Obsolete]
        cookieEnabled
    }

    public enum ScreeResolution
    {
        None,
        /// <summary>
        /// 480X800
        /// <para>400X666.6666,[0.8333,1.2000]</para>
        /// </summary>
        WVGA,
        /// <summary>
        /// 768X1280
        /// <para>WP(Sliverlight):480X853</para>
        /// <para>WP:</para>
        /// </summary>
        WXGA,
        /// <summary>
        /// 720X1280
        /// <para>WP(Sliverlight):480X853</para>
        /// <para>WP:514.2857X914.2857,[1.0714,0.9333]</para>
        /// </summary>
        HD720P
    }


}
